package com.cs.framework.jdbc.hibernate3.exception;

import com.cs.framework.common.exception.CSRuntimeException;

/**
 * Hibernate异常协助者
 * 
 * @author hedongzhou
 * 
 */
public class HibernateExceptionHelper {

	/**
	 * Hibernate异常信息封装对象
	 */
	private final static HibernateExceptionMessage hibernateExceptionMessage = new HibernateExceptionMessage();

	/**
	 * 获取Hibernate异常信息封装对象
	 * 
	 * @return
	 */
	public static HibernateExceptionMessage getMessage() {
		return hibernateExceptionMessage;
	}

	/**
	 * 抛出Hibernate异常
	 * 
	 * @param code
	 *            异常信息编号
	 */
	public static void throwJdbcException(String code) {
		throw new CSRuntimeException(hibernateExceptionMessage, code);
	}

	/**
	 * 抛出Hibernate异常
	 * 
	 * @param code
	 *            异常信息编号
	 * @param params
	 *            异常信息动态内容
	 */
	public static void throwJdbcException(String code, Object... params) {
		throw new CSRuntimeException(hibernateExceptionMessage, code, params);
	}

}
